import config from "@/config";
import RequestBase from "@/utils/request.js";

const baseRequest = new RequestBase(config.safetyUrl);

// 隐患排查待办列表
export function getTodoList(pageNum) {
  return baseRequest.get(
    "/business/app/hidden-danger/task/todo-list?pageNum=" + pageNum
  );
}

// 隐患排查项信息
export function getItem(subTaskId) {
  return baseRequest.get(`/business/app/hidden-danger/task/item/${subTaskId}`);
}

// 完成隐患排查
export function completeCheck(data) {
  return baseRequest.post(`/business/app/hidden-danger/task/handle`, data);
}

// 查询所属风险区域
export function getRiskAreaList() {
  return baseRequest.get("/business/web/risk-area/list");
}

// 查询所属重大危险源
export function getDangerSourceList() {
  return baseRequest.get("/major-hazard/web/danger-source-info/list");
}

// 隐患排查任务列表
export const hiddenDangerDispatchList = (data) => {
  return baseRequest.get('/business/app/hidden-danger/task/distribute-task-list', data)
}

// 隐患排查任务排查项
export const hiddenDangerCheckItem = (id) => {
  return baseRequest.get(`/business/app/hidden-danger/task/${id}`)
}

// 隐患排查任务详情
export const checkTaskInfo = (id) => {
  return baseRequest.get(`/business/app/hidden-danger/task/${id}`)
}

// 隐患排查任务派发
export const checkItemDispatch = (planTaskId, checkUserIds) => {
  return baseRequest.put(`/business/app/hidden-danger/task/distribute/${planTaskId}/${checkUserIds}`)
}
